home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / math / daubwave / daubwave.doc < prev    next >
Text File  |  1993-01-14  |  36KB  |  974 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  DAUBWAVE.DOC - This file contains the documentation for the program
  9.  DAUBWAVE.EXE.
  10.  Written by Steven Gollmer, October 28, 1992
  11.  
  12.  Introduction.............................................2
  13.  DAUBWAVE.................................................3
  14.       I.   Options........................................3
  15.            A.  Default....................................3
  16.            B.  Output, -o <filename>......................4
  17.            C.  Wavelet Function, -d#......................4
  18.            D.  Normalization, -n#.........................4
  19.            E.  Actions....................................4
  20.                 1)  Transform, -t#........................4
  21.                 2)  Inverse, -i#..........................4
  22.                 3)  Series, -s#...........................4
  23.                 4)  Low Pass Filter, -l#..................5
  24.                 5)  High Pass Filter, -h#.................5
  25.                 6)  Band Pass Filter, -b#.................5
  26.                 7)  Notch Filter, -k#.....................5
  27.            F.  Other......................................5
  28.                 1)  Rotate, -r............................5
  29.                 2)  Shift by 1, -1........................5
  30.                 3)  Unix Redirection, -u..................5
  31.                 4)  Compression, -c.......................5
  32.       II.  Examples.......................................6
  33.            A.  Default....................................6
  34.            B.  Output, -o <filename>......................6
  35.            C.  Wavelet Function, -d#......................6
  36.            D.  Normalization, -n#.........................7
  37.                 E.  Actions...............................8
  38.                 1)  Transform, -t#........................8
  39.                 2)  Inverse, -i#..........................9
  40.                 3)  Series, -s#...........................9
  41.                 4)  Low Pass Filter, -l#..................10
  42.                 5)  High Pass Filter, -h#.................10
  43.                 6)  Band Pass Filter, -b#.................11
  44.                 7)  Notch Filter, -k#.....................12
  45.            F.  Other......................................12
  46.                 1)  Rotate, -r............................12
  47.                 2)  Shift by 1, -1........................13
  48.                 3)  Unix Redirection, -u..................13
  49.                 4)  Compression, -c.......................13
  50.       III. Program Cautions...............................13
  51.            A.  Round Off Error............................13
  52.            B.  Zero Padding...............................14
  53.            C.  Wrap Around................................14
  54.            D.  Option Usage...............................14
  55.  Conclusion...............................................14
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.                                        1
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  Introduction
  72.  This program is made available as is.  The author is not liable for any
  73.  damage to hardware or data due to the use of this program.  If there are
  74.  problems, I would like to help you, but I can not be responsible for problems
  75.  that may occur on machines that I have not tested this program nor for uses
  76.  of this program in combination with other programs.  This program may be
  77.  modified and used for personal use, but any distribution of original code or
  78.  modifications of original code can not be made without the author's consent.
  79.  Money may not be collected for distributing this code apart from the amount
  80.  needed to provide the media, shipping and a modest processing fee.
  81.       Files included in this release of DAUBWAVE are as follows.
  82.  
  83.       DAUBWAVE.EXE - Program to run under MSDOS
  84.       DAUBWAVE.DOC - Documentation on program's options
  85.       DAUBWAVE.C - Code for this program.  ANSI C version is also available
  86.  
  87.       The purpose of this program is to perform wavelet based operations on a
  88.  data set.  It should be useful in learning orthogonal wavelet analysis as
  89.  well as data analysis using orthogonal wavelets.  This program uses
  90.  orthogonal wavelet analysis based on Daubechies' derived coefficients.
  91.  References which may be useful in understanding my code would be as follows.
  92.  
  93.  Daubechies, I., 1988:  Commun. Pure and Appl. Math., vol. 41, pp. 909-996.
  94.  Mallat, S.G., 1989:  IEEE Trans. on Pattern Analysis and Machine
  95.  Intelligence, vol. 11, pp. 674-693.
  96.  Press, William H., 1992:  'Numerical Recipes for Fortran, 2nd Ed.  New York:
  97.  Cambridge University Press.
  98.  Strang, G. 1989:  SIAM Review, vol. 31, pp. 614-627.
  99.  
  100.       I do not want to give a thorough discussion of orthogonal wavelets here,
  101.  but I do need to clarify a few concepts.  The orthogonal wavelet transform
  102.  decomposes a data set onto an orthogonal basis set.  This orthogonal basis
  103.  set consists of a fundamental wavelet which is translated by steps of 2 and
  104.  scaled by factors of 2.  A single coefficient is calculated as an inner
  105.  product of a wavelet vector with a data vector.  A series of coefficients are
  106.  generated by applying the inner product N/2 times, shifting the wavelet
  107.  vector by 2 positions each time.  N is the number of points within the data
  108.  set.  The wavelet function extracts information about differences between
  109.  adjacent positions within the data.  A companion function which retains
  110.  information about the averages between adjacent points is the scale function
  111.  and it is applied in the afore mentioned way to generate a second series of
  112.  coefficients.  These two series of coefficients are each half as long as the
  113.  original data set.  The one series corresponds to the coefficients generated
  114.  from inner products with the scale function which will be designated the
  115.  'smoothed' data.  The second series corresponds to the coefficients generated
  116.  from the inner products with the wavelet function which will be designated
  117.  the 'detail' of the data.  Therefore, an original data set of 1024 values
  118.  will be decomposed into two series of 512 values.  When the results are saved
  119.  to a file, the smoothed data is saved first followed by the detail of the
  120.  data.  This transform will be called a first level transform and it only
  121.  applies the wavelet function at the smallest scale.  If the above analysis is
  122.  done along with an analysis using the function expanded by a factor of two,
  123.  the results will be called a second level transform.  From multiresolution
  124.  
  125.  
  126.  
  127.  
  128.                                        2
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  analysis, the transform using a wavelet expanded by a factor of 2 is the same
  136.  as applying the original wavelet transform to the smoothed data of the first
  137.  level transform.  When a second level transform is performed there are three
  138.  series of results.  The following diagram illustrates the notation and the
  139.  relationship of levels of the analysis to the transformed data.
  140.  
  141.  o0   o1   o2   o3   o4   o5   o6   o7   (original)
  142.  
  143.  s0   s1   s2   s3   d0   d1   d2   d3   (level 1)
  144.  
  145.  ss0  ss1  sd0  sd1  d0   d1   d2   d3   (level 2)
  146.  
  147.  sss0 ssd0 sd0  sd1  d0   d1   d2   d3   (level 3)
  148.  
  149.  d - detail of the data
  150.  s - smoothed data
  151.  # - indicates the position within a particular series of results
  152.  
  153.  The order of the 's's and 'd's indicates the processes that have been applied
  154.  to the original data to get the corresponding coefficient.  For ssd the data
  155.  has been transformed three times.  The first time the scaling
  156.  function(smoothing) was applied, next the  2X scaling function(smoothing at
  157.  larger scale) was applied and finally the four times wavelet function(detail
  158.  at the largest scale) was applied.  Notice that once the detail of the data
  159.  has been calculated no further transform is performed on it.  The transform
  160.  can be taken to some maximum level, Y, as long as the original data has a
  161.  length of 2 to the Yth power.  The advantage of the orthogonal wavelet
  162.  transform is that all of the information of the original data set is retained
  163.  and can be used to reconstruct the original data set.
  164.  
  165.  
  166.  DAUBWAVE
  167.  This program performs a number of different functions which are all based on
  168.  the wavelet transform.  The first section summarizes each option.  This is
  169.  followed by a section giving examples of these options.  Finally some
  170.  comments are made about various idiosyncrasies of this implementation of the
  171.  wavelet transform.
  172.  
  173.  
  174.  I.   Options
  175.  The order of discussion has been chosen to place the emphasis on the most
  176.  important and useful functions first followed by more specialized options
  177.  available in the program.
  178.  
  179.    A.  Default
  180.  The program DAUBWAVE will work as long as an input file name is given after
  181.  the program name.  The file is assumed to be sequential floating point
  182.  numbers separated by any white space.  The program will use a default wavelet
  183.  function of D4.  The default normalization will apply the square root of two
  184.  on both the forward and the inverse transform.  The default action taken is
  185.  the forward wavelet transform and this transform will be performed to the
  186.  maximum number of levels possible.  The output file will consist of floating
  187.  point numbers placed on separate lines and the file name will be generated
  188.  using the rules discussed in the next section.
  189.  
  190.  
  191.  
  192.  
  193.                                        3
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.    B.  Output, -o <filename>
  202.  The output file name can be explicitly set by using the -o option.  If only
  203.  the root name of the file is specified, the extension of the file will be
  204.  determined from three option settings within the program.  The first is the
  205.  particular action taken.  If a forward transform is performed then the first
  206.  character in the extension will be a 't'.  The second is the particular
  207.  wavelet function used.  If the D4 wavelet is used, then the second character
  208.  in the extension will be a '4'.  The last character will indicate the number
  209.  of levels to which the action was taken.  If the action was taken to the 5th
  210.  level then the last character of the extension would be '5'.  If the -o
  211.  option is not given, the root name of the output file is the same as the root
  212.  of the input file.
  213.  
  214.    C.  Wavelet Function, -d#
  215.  The wavelet function can be set using the -d# option.  The value of # must an
  216.  even number between 2 and 20.  This will give orthogonal wavelets ranging
  217.  from D2 (Haar wavelet) to D20.  Daubechies' orthogonal wavelets of higher
  218.  order are not incorporated into this program.  The default wavelet is D4.
  219.  
  220.    D.  Normalization, -n#
  221.  The normalization process for the wavelet transform involves a factor of 1/2.
  222.  This can be applied either on the forward transform or the inverse transform.
  223.  The normalization options available in this program are to divide by two only
  224.  on the inverse transform (# = 1), to divide both the forward and inverse
  225.  transform by the square root of two (# = 2) or to divide by two only on the
  226.  forward transform (# = 3).  The default value is (# = 2)
  227.  
  228.    E.  Actions
  229.  All of the actions described in this section can have a number following
  230.  them.  # is the level to which the action is to be taken.  If # is not
  231.  specified then DAUBWAVE will perform the transform to the maximum number of
  232.  levels possible as determined by the length of the data set.  The default
  233.  action is -t.
  234.  
  235.    1)  Transform, -t#
  236.  This option performs a forward wavelet transform on the data.  Once this is
  237.  done the results are saved to the output file.
  238.  
  239.    2)  Inverse, -i#
  240.  This option performs only the inverse wavelet transform on the data.  Once
  241.  this is done the results are saved to the output file.
  242.  
  243.    3)  Series, -s#
  244.  This option is the same as the -t# option except the results from each level
  245.  of the forward transform are saved as separate files.  The extension of the
  246.  output file name is different from the procedure mentioned previously.
  247.  Instead of the first character indicating the action taken, it is now the
  248.  highest level to which the transform is taken.  The second character still
  249.  indicates the wavelet function used; however, the last character indicates
  250.  which level of the transform is saved to this file.  The smoothed results
  251.  from the highest level of the transform will use a level of '0'.  The detail
  252.  results from the highest level of the transform will use '1'.  The file with
  253.  the third character matching the first character in the file extension will
  254.  
  255.  
  256.  
  257.  
  258.                                        4
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  contain the detail results from the first pass of the forward transform.
  266.  Since more than one file will be generated with this option, it is
  267.  incompatible with the -o option where the full filename is specified.
  268.  
  269.    4)  Low Pass Filter, -l#
  270.  This option performs the forward transform and then sets all of the detail
  271.  results to zero.  The inverse transform is then performed and the results are
  272.  sent to the output.
  273.  
  274.    5)  High Pass Filter, -h#
  275.  This option performs the forward transform and then sets all of the smoothed
  276.  results to zero.  The inverse transform is then performed and the results are
  277.  sent to the output.
  278.  
  279.    6)  Band Pass Filter, -b#
  280.  This option performs the forward transform and then sets the smoothed results
  281.  to zero along with any detail results which were generated before the last
  282.  level of the transform.  The inverse transform is then performed and the
  283.  results are sent to the output.
  284.  
  285.    7)  Notch Filter, -k#
  286.  This option performs the forward transform and then sets the detail results
  287.  of the last level of the transform to zero.  The inverse transform is then
  288.  performed and the results are sent to the output.
  289.  
  290.    F.  Other
  291.  These options are not applied as a default.  They must be specified if they
  292.  are to take affect.
  293.  
  294.    1)  Rotate, -r
  295.  When working with higher order Daubechies wavelets, the main weighting of the
  296.  function does not correspond with the zero point of the x-axis.  This makes
  297.  it difficult to match features in the analysis with features of the original
  298.  data set.  This option rotates both the smoothed and detail results so as to
  299.  get correspondence between features.
  300.  
  301.    2)  Shift by 1, -1
  302.  Since the wavelet transform begins its operations only on even data
  303.  positions, calculations starting on odd points are ignored.  Though this
  304.  information is redundant for purposes of reconstructing the original data
  305.  set, it is different from the calculations done on even points.  This option
  306.  shifts the starting point of the wavelet transform by one point, thus
  307.  allowing the transform to begin its operations on odd data positions.
  308.  
  309.    3)  Unix Redirection, -u
  310.  With certain applications it is beneficial to use unix style redirection of
  311.  input and output.  This option forces the program to receive input for the
  312.  standard input and send the results to the standard output.
  313.  
  314.    4)  Compression, -c
  315.  On machines that support ANSI C the use of binary input and output are
  316.  allowed.  In this case it is more efficient to use the IEEE binary floating
  317.  point format.  This not only saves space but also retains the precision of
  318.  the original numbers.  When this option is specified, the input and output
  319.  
  320.  
  321.  
  322.  
  323.                                        5
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  files are opened as binary files and assumed to be in IEEE floating point
  331.  format.  This option may not be available on the distributed code due to
  332.  incompatibilities.  If you want to use this option contact me and I can send
  333.  code which can make this option available.
  334.  
  335.  
  336.  II.  Examples
  337.  The following examples are given to illustrate the different options
  338.  available with DAUBWAVE.  The different results are based on an initial data
  339.  file of length 8 named TEST.DAT.
  340.  
  341.  TEST.DAT
  342.  2.0       4.0       6.0       8.0       1.0       3.0       5.0       7.0
  343.  
  344.  When an example is given, it will consist of three lines.  The first is the
  345.  command given to the computer.  The second is the name of the file that is
  346.  generated by the computer.  The third line is the data contained within this
  347.  file.
  348.  
  349.    A.  Default
  350.  The file TEST.T43 is obtain when the default options are used.
  351.  
  352.  DAUBWAVE TEST.DAT
  353.  TEST.T43
  354.  12.7279   1.0953    -3.9886   -2.9396   0         -3.1820   0         -2.4749
  355.  
  356.  The root of the output file is the same as that of the input file.  The
  357.  extension indicates that the forward transform was performed using the D4
  358.  wavelet and the transform was performed to three levels.  This is the maximum
  359.  number allowed since the data set is only 8 points long.  The same result
  360.  would have been obtained with the following options explicitly listed.
  361.  
  362.  DAUBWAVE TEST.DAT -d4 -n2 -t
  363.  
  364.    B.  Output, -o <filename>
  365.  Specifying the output file name is done with this option.  To have the output
  366.  sent to the file DATA.OUT use the following command.
  367.  
  368.  DAUBWAVE TEST.DAT -o DATA.OUT
  369.  DATA.OUT
  370.  12.7279   1.0953    -3.9886   -2.9396   0         -3.1820   0         -2.4749
  371.  
  372.  If only the root is specified the extension will be generated using the
  373.  action type, wavelet type and number of levels.
  374.  
  375.  DAUBWAVE TEST.DAT -o DATA
  376.  DATA.T43
  377.  12.7279   1.0953    -3.9886   -2.9396   0         -3.1820   0         -2.4749
  378.  
  379.    C.  Wavelet Function, -d#
  380.  The possible wavelet functions available in this program are D2 through D20.
  381.  Examples of each of these functions follows.
  382.  
  383.  DAUBWAVE TEST.DAT -d2
  384.  
  385.  
  386.  
  387.  
  388.                                        6
  389.  
  390.  
  391.  
  392.  
  393.  
  394.  
  395.  TEST.T23
  396.  12.7279   1.4142    -4        -4        -1.4142   -1.4142   -1.4142   -1.4142
  397.  
  398.  DAUBWAVE TEST.DAT -d4
  399.  TEST.T43
  400.  12.7279   1.0953    -3.9886   -2.9396   0         -3.1820   0         -2.4749
  401.  
  402.  DAUBWAVE TEST.DAT -d6
  403.  TEST.T63
  404.  12.7279   0.3698    -1.3303   -2.9942   -4.2680   1.0860    -3.3196   0.8447
  405.  
  406.  DAUBWAVE TEST.DAT -d8
  407.  TEST.T83
  408.  12.7279   -0.4491   -1.2846   0.3577    1.5696    -3.7826   1.2208    -4.6646
  409.  
  410.  DAUBWAVE TEST.DAT -d10
  411.  TEST.TA3
  412.  12.7279   -1.0799   1.7935    0.7742    -3.7172   1.1383    -4.4688   1.3908
  413.  
  414.  DAUBWAVE TEST.DAT -d12
  415.  TEST.TC3
  416.  12.7279   -1.3266   2.7453    2.7759    0.6061    -3.8063   0.6592    -3.1158
  417.  
  418.  DAUBWAVE TEST.DAT -d14
  419.  TEST.TE3
  420.  12.7279   -1.1259   3.2257    4.2041    -2.8123   -0.4342   -2.1134   -0.2969
  421.  
  422.  DAUBWAVE TEST.DAT -d16
  423.  TEST.TG3
  424.  12.7279   -0.5581   4.8306    3.1613    -1.6783   -0.9271   -1.4059   -1.6456
  425.  
  426.  DAUBWAVE TEST.DAT -d18
  427.  TEST.TI3
  428.  12.7279   0.1846    2.6627    4.4807    0.2106    -2.5053   -0.4923   -2.8698
  429.  
  430.  DAUBWAVE TEST.DAT -d20
  431.  TEST.TK3
  432.  12.7279   0.8614    3.2201    1.8394    -3.3837   0.4552    -3.8266   1.0983
  433.  
  434.  One thing to note in the output file's extension is that when numbers are
  435.  larger than 9 an alphabetic designation is used.  This is similar to
  436.  hexadecimal notation except it extends beyond 'F = 15'.  Therefore, the
  437.  highest wavelet possible, D20, will cause the 2nd value of the extension to
  438.  be 'K'.
  439.  The noted similarity between each of these results is that the first value is
  440.  12.7279.  This number is equal to the average of the whole data set
  441.  multiplied by the square root of 2 to the power 3, where 3 is the number of
  442.  levels of the analysis.
  443.  
  444.    D.  Normalization, -n#
  445.  To adjust the type of normalization incorporated, the -n# option is used.
  446.  There are three ways the normalization have been implemented in this program.
  447.  The first is to apply the normalization on the inverse transform only.  When
  448.  
  449.  
  450.  
  451.  
  452.  
  453.                                        7
  454.  
  455.  
  456.  
  457.  
  458.  
  459.  
  460.  the transform is done to the maximum level, Y, the first value of the result
  461.  will be the average of the data set times two to the Y power.
  462.  
  463.  DAUBWAVE TEST.DAT -n1
  464.  TEST.T43
  465.  36        3.0981    -7.9772   -5.8792   0         -4.5      0         -3.5
  466.  
  467.  The second is to divide both the forward and inverse transform by the square
  468.  root of two.  When the transform is done to the maximum level, Y, the first
  469.  value of the result will be the average of the data set times the square root
  470.  of two taken to the Y power.
  471.  
  472.  DAUBWAVE TEST.DAT -n2
  473.  TEST.T43
  474.  12.7279   1.0953    -3.9886   -2.9396   0         -3.1820   0         -2.4749
  475.  
  476.  The third is to divide the forward transform by two.  When the transform is
  477.  done to the maximum level, Y, the first value of the result will be the
  478.  average of the data set.
  479.  
  480.  DAUBWAVE TEST.DAT -n3
  481.  TEST.T43
  482.  4.5       0.3873    -1.9943   -1.4698   0         -2.25     0         -1.75
  483.  
  484.  One word of warning about the normalization scheme.  If you do a multiple
  485.  level transform with one normalization and do the inverse with a different
  486.  normalization you will not end up with a result which is a simple
  487.  multiplication by a normalization factor.  Rather you will have a mixing of
  488.  normalization factors at different scales giving you a non-linear combination
  489.  of the normalization factors.
  490.  
  491.    E.  Actions
  492.    1)  Transform, -t#
  493.  The option -t indicates that the forward transform of the data is to be
  494.  taken.  The transform can be taken to any number of levels up to its maximum
  495.  which is determined by the length of the data set.  The simplest form of this
  496.  option is as follows.
  497.  
  498.  DAUBWAVE TEST.DAT -t
  499.  TEST.T43
  500.  12.7279   1.0953    -3.9886   -2.9396   0         -3.1820   0         -2.4749
  501.  
  502.  Examples are given for transforms taken to the 1st, 2nd and third levels.  To
  503.  best illustrate what is happening with the wavelet transform, a series of
  504.  results are generated at different levels of the transform using the options
  505.  -d2 -n3.  Under these conditions the smoothed result is just the average of
  506.  each pair of points in the data series while the detail result is the
  507.  difference from this average.
  508.  
  509.  DAUBWAVE TEST.DAT -d2 -n3 -t1
  510.  TEST.T21
  511.  3         7         2         6         -1        -1        -1        -1
  512.  (s)                                     (d)
  513.  
  514.  
  515.  
  516.  
  517.  
  518.                                        8
  519.  
  520.  
  521.  
  522.  
  523.  
  524.  
  525.  Transforming to two levels is the same as transforming the data once and then
  526.  transforming only the smoothed result to obtain a smoothed-smoothed (ss)
  527.  result, a detail-smoothed (sd) result and a detail (d) result.
  528.  
  529.  DAUBWAVE TEST.DAT -d2 -n3 -t2
  530.  TEST.T22
  531.  5         4         -2        -2        -1        -1        -1        -1
  532.  (ss)                (sd)                (d)
  533.  
  534.  Each additional level only operates on the smoothed result from the previous
  535.  level.  At the maximum level there are just two points that are operated on
  536.  which give an overall average (sss) of the data set.
  537.  
  538.  DAUBWAVE TEST.DAT -d2 -n3 -t3
  539.  TEST.T23
  540.  4.5       0.5       -2        -2        -1        -1        -1        -1
  541.  (sss)     (ssd)     (sd)                (d)
  542.  
  543.    2)  Inverse, -i#
  544.  The inverse of the transformed data can be obtained by using the following
  545.  command.
  546.  
  547.  DAUBWAVE TEST.T43 -i
  548.  TEST.I43
  549.  2         3.9999    5.9999    7.9999    0.9999    2.9999    4.9999    6.9999
  550.  
  551.  To best illustrate the inverse process again use the options -d2 -n3.  To
  552.  reconstruct the results of the previous level first add the detail to the
  553.  smoothed result then subtract the detail from the smoothed result.
  554.  
  555.  Begin with the transformed data.
  556.  
  557.  DAUBWAVE TEST.DAT -d2 -n3 -t1
  558.  TEST.T21
  559.  3         7         2         6         -1        -1        -1        -1
  560.  (s)                                     (d)
  561.  
  562.  DAUBWAVE TEST.DAT -d2 -n3 -i1
  563.  TEST.I21
  564.  2         4         6         8         1         3         5         7
  565.  
  566.  The first value, 2, is obtained by taking the sum of the first detail result,
  567.  -1, with the first smoothed result, 3.  The second value, 4, is obtained by
  568.  taking the difference of the first detail result, -1, with the first smoothed
  569.  result, 3.  This process is repeated to reconstruct the rest of the data set.
  570.  
  571.    3)  Series, -s#
  572.  This option saves each level of the forward transformation into separate
  573.  files thus making it easier to correlate features at different levels of the
  574.  analysis.
  575.  
  576.  DAUBWAVE TEST.DAT -n3 -s3
  577.  TEST.DAT
  578.  2.0  4.0  6.0  8.0  1.0  3.0  5.0  7.0       (original)
  579.  
  580.  
  581.  
  582.  
  583.                                        9
  584.  
  585.  
  586.  
  587.  
  588.  
  589.  
  590.  TEST.343
  591.  0         -2.25     0         -1.75          (d)
  592.  TEST.342
  593.  -1.9943             -1.4698                  (sd)
  594.  TEST.341
  595.  0.3873                                       (ssd)
  596.  TEST.340
  597.  4.5                                          (sss)
  598.  
  599.  The first position of the file extension contains the number of the maximum
  600.  level of the analysis.  The last number of the extension is the particular
  601.  level within the analysis.
  602.  
  603.    4)  Low Pass Filter, -l#
  604.  This option performs a low pass filter on the data set by calculating the
  605.  forward transform of the data and then setting the detail portion equal to
  606.  zero.  The inverse transform then gives a result which has the high frequency
  607.  portion of the data removed.  If the low pass filter is performed at the
  608.  maximum level, the result will be the average of the data set.  Several
  609.  examples are given along with their transforms to show which values have been
  610.  set to zero.
  611.  
  612.  DAUBWAVE TEST.DAT -l1
  613.  TEST.L41
  614.  4.0703    2.8047    5.5882    7.2868    3.6618    1.4632    4.6797    6.4453
  615.  
  616.  DAUBWAVE TEST.L41 -t1
  617.  TEST.T41
  618.  4.6216    9.4258    3.2074    8.2011    0         0         0         0
  619.  
  620.  DAUBWAVE TEST.DAT -l2
  621.  TEST.L42
  622.  4.4291    4.7645    4.9063    5.0999    4.5709    4.2355    4.0938    3.9001
  623.  
  624.  DAUBWAVE TEST.L42 -t2
  625.  TEST.T42
  626.  9.7745    8.2255    0         0         0         0         0         0
  627.  
  628.  DAUBWAVE TEST.DAT -l3
  629.  TEST.L43
  630.  4.5       4.5       4.5       4.5       4.5       4.5       4.5       4.5
  631.  
  632.  DAUBWAVE TEST.L43 -t3
  633.  TEST.T43
  634.  12.7279   0         0         0         0         0         0         0
  635.  
  636.  One thing to notice is that because of a wrap around effect the first value
  637.  in the filtered result is influenced by the last value in the data series
  638.  thus causing it to be large compared to its initial value.
  639.  
  640.    5)  High Pass Filter, -h#
  641.  By specifying the -h# option a high pass filter will be applied.  As in the
  642.  low pass filter a portion of the transformed data set is set to zero.  In
  643.  this case the smoothed data is set to zero after the forward transform.
  644.  
  645.  
  646.  
  647.  
  648.                                       10
  649.  
  650.  
  651.  
  652.  
  653.  
  654.  
  655.  Applying this filter to the maximum level effectively removes the mean of the
  656.  data.
  657.  
  658.  DAUBWAVE TEST.DAT -h1
  659.  TEST.H41
  660.  -2.0703   1.1953    0.4118    0.7132    -2.6618   1.5368    0.3203    0.5547
  661.  
  662.  DAUBWAVE TEST.H41 -t1
  663.  TEST.T41
  664.  0         0         0         0         0         -3.1820   0         -2.4749
  665.  
  666.  DAUBWAVE TEST.DAT -h2
  667.  TEST.H42
  668.  -2.4291   -0.7645   1.0938    2.9001    -3.5709   -1.2355   0.9063    3.0999
  669.  
  670.  DAUBWAVE TEST.H42 -t2
  671.  TEST.T42
  672.  0         0         -3.9886   -2.9396   0         -3.1820   0         -2.4749
  673.  
  674.  DAUBWAVE TEST.DAT -h3
  675.  TEST.H43
  676.  -2.5      -0.5      1.5       3.5       -3.5      -1.5      0.5       2.5
  677.  
  678.  DAUBWAVE TEST.H43 -t3
  679.  TEST.T43
  680.  0         1.0953    -3.9886   -2.9396   0         -3.1820   0         -2.4749
  681.  
  682.    6)  Band Pass Filter, -b#
  683.  By specifying the -b# option a band pass filter will be applied.  The
  684.  transform is performed to the specified level and then the smoothed and
  685.  detail data from other levels are set to zero.  There is no difference in
  686.  results for the specific cases of -b1 and -h1.
  687.  
  688.  DAUBWAVE TEST.DAT -b1
  689.  TEST.B41
  690.  -2.0703   1.1953    0.4118    0.7132    -2.6618   1.5368    0.3203    0.5547
  691.  
  692.  DAUBWAVE TEST.B41 -t1
  693.  TEST.T41
  694.  0         0         0         0         0         -3.1820   0         -2.4749
  695.  
  696.  DAUBWAVE TEST.DAT -b2
  697.  TEST.B42
  698.  -0.3589   -1.9598   0.6820    2.1869    -0.9091   -2.7723   0.5860    2.5452
  699.  
  700.  DAUBWAVE TEST.B42 -t2
  701.  TEST.T42
  702.  0         0         -3.9886   -2.9396   0         0         0         0
  703.  
  704.  DAUBWAVE TEST.DAT -b3
  705.  TEST.B43
  706.  -0.0709   0.2645    0.4063    0.5999    0.0709    -0.2645   -0.4063   -0.5999
  707.  
  708.  DAUBWAVE TEST.B43 -t3
  709.  
  710.  
  711.  
  712.  
  713.                                       11
  714.  
  715.  
  716.  
  717.  
  718.  
  719.  
  720.  TEST.T43
  721.  0         1.0953    0         0         0         0         0         0
  722.  
  723.    7)  Notch Filter, -k#
  724.  By specifying the -k# option a notch filter will be applied.  The transform
  725.  is performed to the specified level and then the detail data from that
  726.  particular level is set to zero.  There is no difference in results for the
  727.  specific cases of -k1 and -l1.
  728.  
  729.  DAUBWAVE TEST.DAT -k1
  730.  TEST.K41
  731.  4.0703    2.8047    5.5882    7.2868    3.6618    1.4632    4.6797    6.4453
  732.  
  733.  DAUBWAVE TEST.K41 -t1
  734.  TEST.T41
  735.  4.6216    9.4258    3.2074    8.2011    0         0         0         0
  736.  
  737.  DAUBWAVE TEST.DAT -k2
  738.  TEST.K42
  739.  2.3589    5.9598    5.3180    5.8131    1.9091    5.7723    4.4140    4.4549
  740.  
  741.  DAUBWAVE TEST.K42 -t2
  742.  TEST.T42
  743.  9.7745    8.2255    0         0         0         -3.1820   0         -2.4749
  744.  
  745.  DAUBWAVE TEST.DAT -k3
  746.  TEST.K43
  747.  2.0709    3.7355    5.5938    7.4001    0.9291    3.2645    5.4063    7.5999
  748.  
  749.  DAUBWAVE TEST.K43 -t3
  750.  TEST.T43
  751.  12.7279   0         -3.9886   -2.9396   0         -3.1820   0         -2.4749
  752.  
  753.    F.  Other
  754.    1)  Rotate, -r
  755.  Using the -r option, the results from the different levels of the analysis
  756.  are rotated so that their relative position matches features in the original
  757.  data set.  The amount of rotation depends on the wavelet type and whether the
  758.  smoothed or detail portion of the transform is considered.  The best way to
  759.  illustrate this is to generate a data series which consists of all zeros
  760.  except for a single value of one.  The following result is for D12 and a
  761.  comparison is made with the original data, the rotated and non-rotated data.
  762.  To show the effect of starting on the odd position of the data, the -1 option
  763.  is also used.
  764.  
  765.  DAUBWAVE TEST.DAT -n3 -s1 (Opt)
  766.  Opt  (none)              (-1)           (-r)                (-r -1)
  767.  data (s)       (d)       (s)       (d)  (s)       (d)       (s)       (d)
  768.  
  769.  0    -.0316    .3153     .0275     .226 .0048     -.0011    .0006     0
  770.  0
  771.  0    .0975     -.1298    -.1298    -.10 -.0316    0         .0275     0
  772.  0
  773.  0    -.2263    .0275     .3153     .032 .0975     0         -.1298    -.11
  774.  
  775.  
  776.  
  777.  
  778.                                       12
  779.  
  780.  
  781.  
  782.  
  783.  
  784.  
  785.  0
  786.  0    .7511     .0006     .4946     -.01 -.2263    .4946     .3153     -.75
  787.  0
  788.  1    .1115     -.0011    0         0    .7511     .3153     .4946     .226
  789.  0
  790.  0    0         0         0         0    .1115     -.1298    0         -0.10
  791.  0
  792.  0    0         0         -.0011    -.11 0         .0275     0         .032
  793.  0
  794.  0    .0048     .4946     .0006     -.75 0         .0006     -.0011    -.01
  795.  0
  796.  It can be seen that when rotation of the results is made the major
  797.  contributions of the analysis match up with the value of 1 in the original
  798.  data set.
  799.  
  800.    2)  Shift by 1, -1
  801.  The -1 option allows data to be shifted one position to the left before the
  802.  analysis takes place.  This effectively analyzes the data starting on odd
  803.  positions within the data as opposed to even positions which is the standard
  804.  way of doing the transform.  The result will be different but can still be
  805.  used to reconstruct the original data set.  Notice the difference in values
  806.  with this simple change in the analysis.
  807.  
  808.  DAUBWAVE TEST.DAT -d2 -n3 -t1 -1
  809.  TEST.T21
  810.  5         4.5       4         4.5       -1        3.5       -1        2.5
  811.  (s)                                     (d)
  812.  
  813.  DAUBWAVE TEST.DAT -d2 -n3 -t1
  814.  TEST.T21
  815.  3         7         2         6         -1        -1        -1        -1
  816.  (s)                                     (d)
  817.  
  818.    3)  Unix Redirection, -u
  819.  The -u option forces the program to receive input from the standard input
  820.  device and to send the output to the standard output device.  This makes it
  821.  possible to run the program using unix redirection and piping.  Error
  822.  messages are sent to the standard error device.
  823.  
  824.  DAUBWAVE -t <TEST.DAT >DATA.OUT
  825.  DATA.OUT
  826.  12.7279   1.0953    -3.9886   -2.9396   0         -3.1820   0         -2.4749
  827.  
  828.    4)  Compression, -c
  829.  The -c option causes the input file to be opened as binary and the results
  830.  are saved as a binary file.  The numbers are saved in the IEEE floating point
  831.  format.  This option is not illustrated here and may not be available on the
  832.  program you have received.
  833.  
  834.  
  835.  III. Program Cautions
  836.    A.  Round Off Error.
  837.  The wavelet transform in this program is calculated in single precision
  838.  floating point to reduce the amount of memory required to do transforms on
  839.  
  840.  
  841.  
  842.  
  843.                                       13
  844.  
  845.  
  846.  
  847.  
  848.  
  849.  
  850.  very large data sets.  If precision is more important, the code can be easily
  851.  converted to double precision.
  852.  
  853.    B.  Zero Padding
  854.    DAUBWAVE operates on data sets which have a length which is equal to a
  855.  power of two (2, 4, 8, 16, 32, 64, 128, ...).  If the data set does not match
  856.  this criteria, the data set is zero padded at the end to make it meet this
  857.  criteria.  Any output will then have the length of the zero padded data set.
  858.  
  859.    C.  Wrap Around
  860.  Since the wavelet function has a finite width, it will extend beyond the end
  861.  of the data set when a calculation is done near the ends of the data set.  If
  862.  zeros are assumed to exist beyond the ends of the data set, there will be a
  863.  loss of information when the data set is reconstructed from the transform.
  864.  To avoid this problem, the last position of the data set is assumed to be
  865.  adjacent to the first position of the data set.  This wrap around of the data
  866.  will show up in such actions as the low pass filter where the last value of
  867.  the data set will affect the first value of the data set.  This wrap around
  868.  effect is assumed at each level of the transform.  Therefore, the higher the
  869.  level of the transform the larger the end effects due to wrap around.
  870.  
  871.    D.  Option Usage
  872.  One advantage of using an orthogonal wavelet transform is that the original
  873.  data can be reconstructed from the transform without any loss of data.  Care
  874.  must be taken to ensure that the same options are used for the inverse as
  875.  with the forward transform.  If the default method is used for generating the
  876.  file name, three of the options are coded into the extension.  This can be
  877.  helpful when trying to transform the data back to its original form.  Options
  878.  which can affect the transform and are not coded into the extension are the
  879.  normalization, shift by one, rotation to correlate the different levels and
  880.  compress data by saving it in binary form.
  881.  
  882.  Conclusion
  883.  This program has been written during the course of my research in Atmospheric
  884.  Science.   If there are any bugs or problems with the program or
  885.  documentation please contact me.  If you have ideas of useful options for the
  886.  program, please let me know by writing to me at the following address.
  887.  
  888.  Steven Gollmer
  889.  Civil Building
  890.  Dept EAS
  891.  Purdue University
  892.  West Lafayette, Indiana   47907
  893.  Phone:    (317) 494-0663
  894.  email:      nls@mace.cc.purdue.edu
  895.  
  896.  The following are acknowledgements for support during the time of this
  897.  program's development.
  898.  
  899.  NSF Grant ATM-8909870
  900.  USRA Graduate Student Program in the Earth Sciences (Summer 1991)
  901.  NASA Graduate Researchers Program Fellowship (1992) NGT-50963
  902.  
  903.  I would also like to acknowledge my advisor and mentor at NASA.
  904.  
  905.  
  906.  
  907.  
  908.                                       14
  909.  
  910.  
  911.  
  912.  
  913.  
  914.  
  915.  Dr. Harshvardhan
  916.  Dept Earth and Atmospheric Sciences
  917.  Purdue University
  918.  West Lafayette, IN
  919.  
  920.  Dr. Robert Cahalan
  921.  Laboratory of Atmospheres
  922.  Goddard Space Flight Center/NASA
  923.  Greenbelt, MD
  924.  
  925.  
  926.  
  927.  
  928.  
  929.  
  930.  
  931.  
  932.  
  933.  
  934.  
  935.  
  936.  
  937.  
  938.  
  939.  
  940.  
  941.  
  942.  
  943.  
  944.  
  945.  
  946.  
  947.  
  948.  
  949.  
  950.  
  951.  
  952.  
  953.  
  954.  
  955.  
  956.  
  957.  
  958.  
  959.  
  960.  
  961.  
  962.  
  963.  
  964.  
  965.  
  966.  
  967.  
  968.  
  969.  
  970.  
  971.  
  972.  
  973.                                       15
  974.